package com.roncoo.student.stu.service.impl;

import com.roncoo.student.stu.entity.Lecturer;
import com.roncoo.student.stu.entity.UserLecturerAttention;
import com.roncoo.student.stu.dao.UserLecturerAttentionMapper;
import com.roncoo.student.stu.service.IUserLecturerAttentionService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author jl
 * @since 2021-04-12
 */
@Service
public class UserLecturerAttentionServiceImpl extends ServiceImpl<UserLecturerAttentionMapper, UserLecturerAttention> implements IUserLecturerAttentionService {

    @Resource
    private UserLecturerAttentionMapper userLecturerAttentionMapper;

    @Override
    public boolean findByUserAndLec(UserLecturerAttention userLecturerAttention) {
        List<UserLecturerAttention> userAndLec = userLecturerAttentionMapper.findByUserAndLec(userLecturerAttention);
        if (userAndLec.size()>0){
            return true;
        }else {
            return false;
        }
    }

    @Override
    public List<Lecturer> finduserLecAttById(Integer userId) {
        return userLecturerAttentionMapper.finduserLecAttById(userId);
    }

    @Override
    public boolean delByUserAndLec(UserLecturerAttention userLecturerAttention) {
        return userLecturerAttentionMapper.delByUserAndLec(userLecturerAttention);
    }
}
